<?php

class mailinglistmodule_config {
	function form($object) {
		if (!defined('SYS_FORMS')) require_once(BASE.'subsystems/forms.php');
		exponent_forms_initialize();

		$form = new form();
		if (!isset($object->id)) {
		$object->phone1 = "";
        $object->phone2 = "";
        $object->facebook = "";
        $object->twitter = "";
        $object->google = "";
        $object->desc = "";
        $object->new_window=0;
			
		} else {
			
			$form->meta('id',$object->id);
		}

		
		$form->register('phone1','Phone 1',new textcontrol($object->phone1,50,false,100,"",true));
        $form->register('phone2','Phone 2',new textcontrol($object->phone2,50,false,100,"",true));
        $form->register('facebook','Facebook',new textcontrol($object->facebook,50,false,100,"",true));
        $form->register('twitter','Twitter',new textcontrol($object->twitter,50,false,100,"",true));
        $form->register('google','Google',new textcontrol($object->google,50,false,100,"",true));
        $form->register('new_window','Open link new window',new checkboxcontrol($object->new_window));
        
        $form->register('desc','Description',new textcontrol($object->desc,50,false,100,"",true));
				
		$form->register('submit','',new buttongroupcontrol('Save','','Cancel'));
		return $form;
	}

	function update($values,$object) {
        $object->phone1 = trim($values['phone1']);
        $object->phone2 = trim($values['phone2']);
        $object->facebook = trim($values['facebook']);
        $object->twitter = trim($values['twitter']);
        $object->google = trim($values['google']);
        $object->desc = trim($values['desc']);
        if (isset($values['new_window'])){
            $object->new_window=1;
        }
        else
        {
            $object->new_window=0;
        }
		return $object;
	}
}

?>
